/* ----------------------------------------------------------------------
*
* Copyright (C) 2025 XiaoFei. All rights reserved.
*
* $file:		XiaoZhi_DHT11.h
* $Date:        17-January-2025
* $Revision: 	V1
* $Project: 	XiaoFei BSP Library
* $Taobao:      https://item.taobao.com/item.htm?abbucket=17&id=794805807365
*
* -------------------------------------------------------------------- */

#ifndef __DHT11_H
#define __DHT11_H

#define RCC_GPIO_DHT11   			    RCC_APB2Periph_GPIOA
#define DHT11_DQ_GPIO		    	    GPIOA
#define DHT11_DQ_Pin			        GPIO_Pin_0

#define DHT11_DQ(x)						GPIO_WriteBit(DHT11_DQ_GPIO,DHT11_DQ_Pin,(BitAction)(x))
#define DHT11_DQRead					GPIO_ReadInputDataBit(DHT11_DQ_GPIO,DHT11_DQ_Pin)

#ifndef DHT11_TypeDef_def
#define DHT11_TypeDef_def
typedef struct
{
	unsigned char humi_H ;		/*!< The high humi data from DHT11 */
	unsigned char humi_L ;      /*!< The low humi data from DHT11 */
	unsigned char Temp_H ;      /*!< The high temp data from DHT11 */
	unsigned char Temp_L ;      /*!< The low temp data from DHT11 */
	unsigned char Chack ;       /*!< The chack data from DHT11 */
	float Temp ;                /*!< The temp data */
	float Humi ;                /*!< The humi data */
}DHT11_TypeDef;
#endif

/* 
* @function: 	DHT11_GetData
* @parameter:	[out] DHT11				    The data from DHT11 device.
* @return:		Successes or failures of the data get from DHT11 device.
*/
unsigned char DHT11_GetData(DHT11_TypeDef* DHT11);
	
#endif
